dnl  run 'autoreconf' to obtain aclocal.m4, and update configure and setup/pkg.m4
dnl  run 'automake -acf' to update setup/{install-sh,missing}

dnl  standard initialization (we only use autoconf not automake)
AC_PREREQ([2.68])
AC_INIT([coccinelle], m4_esyscmd([./version.sh]), [cocci@systeme.lip6.fr], [], [http://coccinelle.lip6.fr/])

AC_CONFIG_MACRO_DIR([setup])
AC_CONFIG_AUX_DIR([setup])
AC_SUBST([CONFIGURE_FLAGS], ["$*"])
AC_SUBST([COCCI_VERSION], ["$PACKAGE_VERSION"])
AC_SUBST([COCCI_SRCDIR], ["$(pwd)"])
AC_MSG_NOTICE([configuring coccinelle $COCCI_VERSION in $COCCI_SRCDIR])
AM_INIT_AUTOMAKE

AC_CONFIG_SRCDIR([cocci.ml])    dnl  this file must be present in our src directory
AC_COCCI_CONFVERSION

dnl  reminder that this configure depends on macros generated by aclocal
AC_MSG_NOTICE([this configure program uses pkg-config m4 macros])
AC_MSG_NOTICE([this configure program uses ocaml m4 macros (see setup/ocaml.m4)])
AC_MSG_NOTICE([this configure program uses custom m4 macros (see setup/cocci.m4)])
AC_MSG_NOTICE([some fake substitutions for required but unavailable programs may be used (see setup/fake*)])


dnl
dnl  Note: the conditionals in this configure script are tricky.
dnl  The approach taken here is that many tools can be enabled/disabled
dnl  and paths can be given explicitly via commandline parameters or
dnl  environment variables.
dnl


dnl
dnl  Basic tools
dnl

AC_MSG_NOTICE([verifying basic tools])

AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_PROG_CPP
AC_PATH_PROG([BASH],[bash])
AC_PATH_PROG([TAR],[tar])
AC_PATH_PROG([PATCH],[patch])
AC_PATH_PROG([ECHO],[echo])

dnl  ensures that INSTALL points to an absolute install-sh when that one is configured.
AS_IF([test "$INSTALL" = "setup/install-sh -c" -o "$INSTALL" = "./setup-install-sh -c"],
[dnl
  AC_SUBST([INSTALL], ["$COCCI_SRCDIR/$INSTALL"])
])

dnl  the same for MKDIR_P
AS_IF([test "$MKDIR_P" = "setup/install-sh -c -d" -o "$INSTALL" = "./setup-install-sh -c -d"],
[dnl
  AC_SUBST([MKDIR_P], ["$COCCI_SRCDIR/$MKDIR_P"])
])

dnl Try to ensure that ECHO will support -e option to handle \t and \n
AS_IF([test "`$ECHO --version`" =  "--version"],
[dnl
  AC_SUBST([ECHO],["$COCCI_SRCDIR/setup/echo.sh"])
])
 
dnl  patchelf is an optional dependency and in principle not used for building coccinelle
AC_PATH_PROG([PATCHELF],[patchelf])

dnl  pkg config is required, but we have an alternative script for it
AC_COCCI_TOOL([PKG_CONFIG],[pkg-config])
AS_IF([test "x$PKG_CONFIG" = xno],
[dnl  no specific pkg-config configured
  AC_SUBST([PKG_CONFIG_ORIG],[pkg-config])
],
[dnl  a specific pkg-config configured
  AC_SUBST([PKG_CONFIG_ORIG],[$PKG_CONFIG])
])

dnl  always use the wrapper around pkg-config
AC_SUBST([PKG_CONFIG],["$COCCI_SRCDIR/setup/fake-subst.sh $PKG_CONFIG_ORIG"])


dnl  ocaml compiler configuration
AC_PROG_OCAML
AC_CHECK_OCAMLVERSION([OCAMLATLEAST312],[3.12])
AS_IF([test "x$OCAMLATLEAST312" = xno],[AC_MSG_ERROR([OCaml >= 3.12 is required to compile Coccinelle])])
AC_CHECK_OCAMLVERSION([OCAMLATLEAST4020],[4.02])
AC_CHECK_OCAMLVERSION([OCAMLATLEAST4030],[4.03])
AC_SUBST([OCAMLCORIG],["$OCAMLC"])

AS_IF([test "x$OCAMLC" = xno -o "x$OCAMLDEP" = xno -o "x$OCAMLDOC" = xno -o "x$OCAMLMKLIB" = xno],
[dnl
  AC_MSG_ERROR([It seems a few components of the OCaml distribution could not be found. Make sure the following tools are installed and in your path: ocamlc, ocamldep, ocamldoc, ocamlmklib.])
])

dnl  ocaml tools
AC_COCCI_TOOL([OCAMLLEX],[ocamllex],[])
AC_COCCI_TOOL([OCAMLYACC],[ocamlyacc],[])
AC_COCCI_TOOL([OCAMLFIND],[ocamlfind],[$COCCI_SRCDIR/setup/fake-subst.sh ocamlfind])
AC_COCCI_TOOL([OCAMLPROF],[ocamlprof],[])

dnl  enforce ocaml tool requirements
AS_IF([test "x$OCAMLLEX" = xno],
[dnl
  AC_MSG_ERROR([the OCaml Lexer needs to be installed (the ocamllex command). It should be part of your OCaml distribution.])
])

AS_IF([test "x$OCAMLYACC" = xno],
[dnl
  AC_MSG_ERROR([The OCaml parser generated needs to be installed (the ocamlyacc command). It should be part of your OCaml distribution.])
])

AS_IF([test "x$OCAMLFIND" = xno],
[dnl
  AC_MSG_ERROR([A suitable OCaml findlib (the ocamlfind command) could not be found.])
])

dnl  these runtime commands can also be passed as runtime flags to spatch.
AC_COCCI_RUNTIME_CMD([OCAMLFIND],[ocamlfind])
AC_COCCI_RUNTIME_CMD([OCAMLC],[ocamlc])
AC_COCCI_RUNTIME_CMD([OCAMLOPT],[ocamlopt])
AC_COCCI_RUNTIME_CMD([OCAMLDEP],[ocamldep])

dnl  AC_CACHE_SAVE


dnl
dnl  Basic ocaml modules
dnl

AC_MSG_NOTICE([verifying basic ocaml modules])

dnl  default dir with the bundled ocaml packages
AC_COCCI_SET_EXTERNAL_DIR([$COCCI_SRCDIR/bundles])

dnl  set some defaults
dnl  add a line for each package that is
dnl  configured via AC_CHECK_COCCI_EXTPKG
dnl  or AC_REQ_COCCI_EXTPKG
AC_COCCI_INIT_PKG_EMPTY([dynlink])
AC_COCCI_INIT_PKG_EMPTY([pcre])
AC_COCCI_INIT_PKG_EMPTY([bytes]) dnl for recent versions of pcre on old OCaml
AC_COCCI_INIT_PKG_EMPTY([pyml])
AC_COCCI_INIT_PKG_EMPTY([stdcompat])
AC_COCCI_INIT_PKG_EMPTY([parmap])

dnl  required ocaml packages
AC_MSG_NOTICE([the following OCaml packages should be provided by your ocaml installation])
AC_REQ_COCCI_STDPKG([unix])
AC_REQ_COCCI_STDPKG([bigarray])
AC_REQ_COCCI_STDPKG([str])

dnl  required modules (Some are available locally too)
AC_REQ_COCCI_EXTPKG([dynlink])
AC_REQ_COCCI_EXTPKG([parmap])
AC_REQ_COCCI_EXTPKG([stdcompat])


dnl  AC_CACHE_SAVE


dnl
dnl  Handling of optional features
dnl

AC_MSG_NOTICE([verifying optional features])

dnl  test if the optimized version of dynlink is available
AS_IF([test "x$OCAML_PKG_dynlink" != xno -a -f "$PATH_dynlink/dynlink.cmxa"],
[dnl  yes
  AC_SUBST([OPTIMIZED_dynlink], [yes])
],
[dnl  no
  AC_SUBST([OPTIMIZED_dynlink], [no])
])


dnl  menhir handling
dnl  variables:
dnl    with_menhir: whether or not menhir must be used
AC_SUBST([PATH_menhirLib_bundle], [$COCCI_SRCDIR/bundles/menhirLib])
AC_SUBST([PATH_menhir_bundle], [$PATH_menhirLib_bundle/menhir])

AC_COCCI_TOOL([MENHIR],[menhir],[$PATH_menhir_bundle])

AS_IF([test "x$SUBSTITUTED_MENHIR" != xyes],
[dnl
  AC_MSG_NOTICE([system menhir will be used])
  AC_SUBST([MAKE_menhirLib],[])
  AS_IF([$MENHIR --help | grep suggest-menhirLib >/dev/null],
    [dnl
      AC_MSG_NOTICE([system menhir will be used])
      AC_SUBST([PATH_menhirLib],[`$MENHIR --suggest-menhirLib`])
    ],
    [dnl
      AS_IF([test -n "$OCAMLFIND"],
        [dnl
          AC_MSG_NOTICE([system menhir will be used])
          AC_SUBST([PATH_menhirLib],[`$OCAMLFIND query menhirLib`])
        ],
        [dnl
          AC_MSG_NOTICE(
            [system menhirLib cannot be found: bundled menhir will be used instead])
          AC_SUBST([MENHIR], [$PATH_menhir_bundle])
          AC_SUBST([SUBSTITUTED_MENHIR], [yes])
        ])
    ])
])

AC_SUBST([FEATURE_menhirLib], [1])

AS_IF([test "x$SUBSTITUTED_MENHIR" = xyes],
[dnl
  AC_SUBST([PATH_menhirLib], [$PATH_menhirLib_bundle])
  AC_SUBST([MAKE_menhirLib], [$PATH_menhirLib])
])

AC_SUBST([FLAGS_menhirLib], [])
AC_SUBST([OPTFLAGS_menhirLib], [])
AC_SUBST([MODULES_menhirLib], [])
AC_SUBST([MODULESOPT_menhirLib], [])

dnl  ocaml script handling
dnl  variables:
dnl    enable_ocaml: whether to enable ocaml scripts
AC_ARG_ENABLE([ocaml], AS_HELP_STRING([--enable-ocaml], [enable ocaml scripting (default: auto)]))
AS_IF([test "x$OCAML_PKG_dynlink" = xno],
[dnl
  AS_IF([test -z "$enable_ocaml"],
  [dnl
    AC_SUBST([enable_ocaml], [no])
    AC_MSG_NOTICE([ocaml scripting is disabled because the 'dynlink' package is not installed])
  ], [test "x$enable_ocaml" != xno],
  [dnl
    AC_MSG_ERROR([the OCaml package dynlink is required for ocaml scripting])
  ])
])

dnl  no optimized version, disable dynlink by default
AS_IF([test "x$OPTIMIZED_dynlink" = xno],
[dnl
  AS_IF([test -z "$enable_ocaml"],
  [dnl
    AC_SUBST([enable_ocaml], [no])
    AC_MSG_NOTICE([ocaml scripting has been disabled by default because the optimized version of dynlink is not available])
  ], [test "x$enable_ocaml" = xyes],
  [dnl
    AC_MSG_NOTICE([warning: the optimized version of dynlink is not available, thus ocaml scripting may not work])
  ])
])

dnl  scripting requirement on ocamlfind
AS_IF([test -n "$SUBSTITUTED_OCAMLFIND"],
[dnl
  AS_IF([test -z "$enable_ocaml"],
  [dnl  this is perhaps a bit too strict
    AC_SUBST([enable_ocaml],[no])
    AC_MSG_NOTICE([ocaml scripting is disabled because it depends on ocamlfind])
  ], [test "x$enable_ocaml" != xno],
  [dnl
    AC_MSG_NOTICE([warning: ocamlfind is not found but may be required when ocaml scripts are used])
  ])
])

AS_IF([test "x$enable_ocaml" = xno],
[dnl
  AC_COCCI_INIT_PKG_EMPTY([dynlink])    dnl  prevent linking with it
  AC_SUBST([OCAMLCOCCI_MODULE], [No_prepare_ocamlcocci])
  AC_SUBST([OCAMLCOCCI_FILE], [no_prepare_ocamlcocci.ml])
],
[dnl
  AC_SUBST([enable_ocaml], [yes])
  AC_SUBST([OCAMLCOCCI_MODULE], [Yes_prepare_ocamlcocci])
  AC_SUBST([OCAMLCOCCI_FILE], [yes_prepare_ocamlcocci.ml])
])


dnl  python handling
dnl  variables:
dnl    with_python: whether to enable the python feature (and what version)
AC_ARG_ENABLE([python], [AS_HELP_STRING([--enable-python], [enable python scripting (yes/no) (default: auto)])])

AC_ARG_WITH([python], [AS_HELP_STRING([--with-python], [which python interpreter to use (default: python)])])

AS_IF([test -n "$with_python"],
[dnl
  AC_SUBST([PYTHON], ["$with_python"])
],
[dnl
  AC_SUBST([PYTHON], ["python"])
])

AS_IF([test "x$enable_python" != xno],
[dnl
  AC_CHECK_COCCI_EXTPKG([pyml])  dnl  will set $enable_pyml to 'yes', 'no', or 'local'
])

AS_IF([test -z "$enable_python"],
[dnl
  AS_IF([test "x$enable_pyml" != xno],
  [dnl
    AC_SUBST([enable_python], [yes])
  ],
  [dnl
    AC_SUBST([enable_python], [no])
  ])
])

AS_IF([test "x$enable_python" != xno],
[dnl
  AC_SUBST([PYCOCCI_MODULE], [Yes_pycocci])
  AC_SUBST([PYCOCCI_FILE],[yes_pycocci.ml])
],
[dnl
  AC_SUBST([PYCOCCI_MODULE], [No_pycocci])
  AC_SUBST([PYCOCCI_FILE],[no_pycocci.ml])
])


dnl  pcre handling
dnl  variables:
dnl    enable_pcre: whether to enable the pcre feature
dnl    OCAML_PKG_pcre: if "local" use str package
AC_ARG_ENABLE([pcre-syntax], AS_HELP_STRING([--enable-pcre-syntax], [enable pcre regular expression syntax (default: auto)]))
AS_IF([test "x$enable_pcre_syntax" != "xno"],
[dnl
  PKG_CHECK_MODULES([PCRE], [libpcre],[AC_SUBST([HAVE_PCRE],[yes])],[AC_SUBST([HAVE_PCRE],[no])])
  AS_IF([test -z "$enable_pcre_syntax" -a "x$HAVE_PCRE" != xyes],
  [dnl
    AC_SUBST([enable_pcre_syntax], [no])
  ],
  [dnl
    AC_CHECK_COCCI_EXTPKG([pcre])  dnl  will set $enable_pcre to 'yes', 'no', or 'local'
    AS_IF([test "x$enable_pcre" == "xyes"],
    [dnl
      AC_MSG_CHECKING([if pcre depends on bytes])
      AS_IF([test "x`$OCAMLFIND query -r -format '%p' pcre 2>/dev/null | grep bytes`" == "xbytes"],
      [dnl
        AC_MSG_RESULT([yes])
        AC_MSG_CHECKING([if bytes is an actual module])
        AS_IF([test -f "`$OCAMLFIND query bytes`/bytes.cma"],
        [dnl
          AC_MSG_RESULT([yes])
          AC_CHECK_COCCI_EXTPKG([bytes])
        ],
        [dnl
          AC_MSG_RESULT([no])
        ])
      ],
      [dnl
        AC_MSG_RESULT([no])
      ])
    ])
  ])
])

AS_IF([test "x$enable_pcre_syntax" != xno],
[dnl
  AS_IF([test "x$HAVE_PCRE" = xyes],
  [dnl
    AC_MSG_NOTICE([support for pcre syntax is enabled])
  ],
  [dnl
    AC_MSG_ERROR([the pcre feature is enabled but the pkg-config libpcre library is not found])
  ])

  AC_SUBST([REGEXP_MODULE], [Regexp_pcre])
  AC_SUBST([REGEXP_FILE], [regexp_pcre.ml])
],
[dnl
  AC_COCCI_INIT_PKG_EMPTY([pcre])
  AC_SUBST([REGEXP_MODULE], [Regexp_str])
  AC_SUBST([REGEXP_FILE], [regexp_str.ml])
])


dnl  AC_CACHE_SAVE


dnl  obtain the value of $prefix
AS_IF([test "$prefix" = "NONE"],[prefix=$ac_default_prefix])


dnl
dnl  backwards compatibility
dnl

dnl  defines some variables needed by the Make infrastructure
AC_SUBST([LIBDIR],["${libdir}/coccinelle"])

AS_IF([test "x$enable_python" != xno],
[dnl
  AC_SUBST([FEATURE_PYTHON], [1])
],
[dnl
  AC_SUBST([FEATURE_PYTHON], [0])
])

AS_IF([test "x$enable_ocaml" != xno],
[dnl
  AC_SUBST([FEATURE_OCAML], [1])
],
[dnl
  AC_SUBST([FEATURE_OCAML], [0])
])

dnl  dynlink stuff depending on the OCaml version and whether it is enabled
AS_IF([test "x$enable_ocaml" = xyes -a "x$OCAMLOPT" != xno],
[dnl
  AC_SUBST([DYNLINK_IS_NATIVE], [Dynlink.is_native])
],
[dnl
  AC_SUBST([DYNLINK_IS_NATIVE], [false])
])

AS_IF([test "x$OCAMLATLEAST4020" = xno  ],
[dnl
  AC_SUBST([GET_TEMP_DIR_NAME_EXPR], ["Filename.temp_dir_name"])
],
[dnl
  AC_SUBST([GET_TEMP_DIR_NAME_EXPR], ["(Filename.get_temp_dir_name ())"])
])


dnl  in case of the compilation of the manual
AC_COCCI_TOOL([PDFLATEX],[pdflatex],[$COCCI_SRCDIR/setup/fake-pdflatex.sh pdflatex])


dnl  determine whether to build the optimizing version
AC_ARG_ENABLE([opt], [AS_HELP_STRING([--enable-opt], [build an optimized spatch (yes,no, default: auto)])])
AS_IF([test "x$OCAMLOPT" = xno -a "x$enable_opt" != xno],
[dnl
  AS_IF([test "x$enable_opt" = xyes],
  [dnl
    AC_MSG_ERROR([the optimized version of coccinelle is requested explicitly, but ocamlopt is absent])
  ],
  [dnl
    AC_MSG_NOTICE([the optimized version of coccinelle will not be build because ocamlopt is not present])
    AC_SUBST([enable_opt], [no])
  ])
])

dnl  disable the optimized target when dynlinking is enabled but the optimized version of dynlink is not available
AS_IF([test "x$OPTIMIZED_dynlink" = xno -a "x$enable_ocaml" = xyes],
[dnl
  AS_IF([test -z "$enable_opt"],
  [dnl
    AC_MSG_NOTICE([the optimized version of coccinelle will not be build by default because ocaml scripting is enabled but the required optimized dynlink package is not present])
    AC_SUBST([enable_opt], [no])
  ], [test "x$enable_opt" = xyes],
  [dnl
    AC_MSG_ERROR([the optimized version of coccinelle in combination with ocaml scripting requires the optimized version of the dynlik package, which is not present])
  ])
])

dnl  set the default enable-opt setting
AS_IF([test -z "$enable_opt"],
[dnl
  AC_SUBST([enable_opt], ["yes"])
])

dnl  variables depending on whether we build the optimized spatch
AS_IF([test "x$enable_opt" = xyes],
[dnl  default target for the optimized version
  AC_SUBST([SPATCHNAME], [spatch.opt])
  AC_SUBST([MAKETARGET_SPATCH], [opt-only])
],
[dnl  default target for the bytecode version
  AC_SUBST([SPATCHNAME], [spatch])
  AC_SUBST([MAKETARGET_SPATCH], [byte-only])
])

dnl bash-completion directory
dnl (reported by Himanshu Jha,
dnl  solution inspired from https://www.swansontec.com/bash-completion.html )
dnl --with-bash-completion enables bash-completion (this is the default),
dnl   and allows the user to give a path. By default, path is given by
dnl   pkg-config if available, or $datarootdir/bash-completion/completions
dnl   otherwise
dnl --without-bash-completion disables bash-completion

AC_ARG_WITH([bash-completion],
    AS_HELP_STRING([--with-bash-completion[=PATH]],
        [Install the bash auto-completion script in this directory.\
         @<:@default=yes@:>@]),
    [],
    [AC_SUBST([with_bash_completion], [yes])])

AS_IF([test "x$with_bash_completion" = "xyes"],
    [dnl
      AS_IF([test "x$prefix" = "x/usr/local"],
      [dnl
       PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
        [AC_SUBST([BASH_COMPLETION_DIR],
                [[`pkg-config --variable=completionsdir bash-completion`]])],
        [AC_SUBST([BASH_COMPLETION_DIR],
                [$datarootdir/bash-completion/completions])])],
      [AC_SUBST([BASH_COMPLETION_DIR],
                [$datarootdir/bash-completion/completions])])],
    [dnl
     AC_SUBST([BASH_COMPLETION_DIR], [$with_bash_completion])])

AS_IF([test "$MAKE_stdcompat"],
  AC_CONFIG_SUBDIRS(bundles/stdcompat/stdcompat-current))

AS_IF([test "$MAKE_parmap"],
  AC_CONFIG_SUBDIRS(bundles/parmap/parmap))

AS_IF([test "$MAKE_pcre"],
  [AS_IF([test "x$OCAMLATLEAST4030" = xno  ],
    [AC_SUBST([CAMLnoreturn_start], [])
     AC_SUBST([CAMLnoreturn_end], [])],
    [AC_SUBST([CAMLnoreturn_start], [CAMLnoreturn_start])
     AC_SUBST([CAMLnoreturn_end], [CAMLnoreturn_end])])
   AS_IF([test "x$OCAMLATLEAST4020" = xno  ],
    [AC_SUBST([intnat], [value])
     AC_SUBST([Val_int], [Val_int])
     AC_SUBST([Val_Val_int], [])
     AC_SUBST([Int_val], [Int_val])
     AC_SUBST([Int_val_val], [])
     AC_SUBST([noalloc], [])
     AC_SUBST([untagged], [])
     AC_SUBST([CAMLnoreturn_start], [])
     AC_SUBST([CAMLnoreturn_end], [])],
    [AC_SUBST([intnat], [intnat])
     AC_SUBST([Val_int], [])
     AC_SUBST([Val_Val_int], [Val_int])
     AC_SUBST([Int_val], [])
     AC_SUBST([Int_val_val], [Int_val])
     AC_SUBST([noalloc], [[[@@noalloc]]])
     AC_SUBST([untagged], [[[@untagged]]])])
  AC_CONFIG_FILES([
    bundles/pcre/pcre-ocaml/src/pcre.ml
    bundles/pcre/pcre-ocaml/src/pcre_stubs.c
  ])])

dnl
dnl  generating configuration
dnl

AC_CONFIG_FILES([
  Makefile.config
  version.ml
  commons/commands.ml
  globals/config.ml globals/regexp.ml python/pycocci.ml
  ocaml/prepare_ocamlcocci.ml
  scripts/spatch.sh
  tools/spgen/scripts/spgen.sh
  docs/spatch.1
  setup/Makefile
])

AC_OUTPUT

AC_MSG_NOTICE([configuration completed])

cat << EOF
------------------------------------------------------------------------------
Summary

configure flags:  $CONFIGURE_FLAGS
findlib:          $OCAMLFIND	(an actual version is strongly recommended)
menhir:           $MENHIR
                  (for local package use --without-menhir,
                   install the menhir package otherwise)

ocaml scripting:  $enable_ocaml	(overridable with --enable-ocaml)
python scripting: $enable_python	(overridable with --enable-python)

pcre regexes:     $enable_pcre_syntax	(overridable with --enable-pcre-syntax)
pcre module:      $enable_pcre	(for local package use --disable-pcre)
pcre library:     $HAVE_PCRE	(requires the libpcre-ocaml-dev package)

optimized spatch: $enable_opt	(overridable with --disable-opt)

bash-completion:  $BASH_COMPLETION_DIR
                  (overridable with --with-bash-completion)

------------------------------------------------------------------------------
Coccinelle can now be compiled and installed.


If you compile coccinelle again after source code changes or
configuration changes, you may need to run first:
  \$ make clean

To compile coccinelle, run:
  \$ make

To install coccinelle, run:
  \$ make install

Then, to test coccinelle, run for example:
  \$ spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c

Or when coccinelle is not installed yet:
  \$ COCCINELLE_HOME=$(pwd) ./scripts/spatch -sp_file demos/simple.cocci demos/simple.c -o /tmp/new_simple.c
EOF

if test "x$enable_python" != "xno"; then
cat << EOF
------------------------------------------------------------------------------
You may need to set some environment variables so that the python
libraries are found. The frontend 'spatch' sets the following variables:

  \$ export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$prefix/lib
  \$ export PYTHONPATH=\$PYTHONPATH:$libdir/coccinelle/python

EOF
fi

cat << EOF
------------------------------------------------------------------------------
EOF
